package Circletest01;

import java.util.Scanner;

public class Round extends Ciecle {
    public static final double PI = 3.14;
    private float R;

    public Round(float r) {
        R = r;
    }

    public Round(float x, float y) {
        super(x, y);
    }

    public Round(float x, float y, float r) {
        super(x, y);
        R = r;
    }

    //圆的周长
    public double perimeter() {
        return 2 * PI * R;
    }

    //圆的位置
    public void position() {
        System.out.println("圆的位置为:" + "(" + super.getX() + super.getY() + ")");
    }

    //圆的面积
    public double area() {
        return PI * R * R;
    }

    //平移
    public void translation() {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入需要在x轴上平移的距离，+代表向右移，-代表向左移");
        float movX = input.nextFloat();
        System.out.println("请输入要在y轴上平移的距离，+代表向上移，-代表向下移");
        float movY = input.nextFloat();
        System.out.println("圆的位置为:" + "(" + super.getX() + movX + "，" + super.getY() + movY + ")");
    }
        public float getR () {
            return R;
        }

        public void setR ( float r){
            R = r;
        }
    }

class test{
    public static void main(String[] args) {
// 方法一： 定义一个点
// Drop drop = new Drop(2,6);
// 方法二： 定义一个点
        Round round = new Round(2, 6);
        round.setR(6.14F); //设置半径
        double perimeter = round.perimeter(); //计算圆的周长
        System.out.println("周长==>"+perimeter);
        double area = round.area(); //计算圆的面积
        System.out.println("面积为==>"+area);
        round.position();// 圆的位置
        round.translation();//平移圆
    }
}
